#打印1-10
# for i in range(1,11):
#     print(i)
#     i+= 1

# for i in range(2,12,2):
#     print(i)

# 打印从 10 到 1
# num=10
# while num>=1:
#     print(num)
#     num -= 1
#
# for i in range(10,0,-1):
#     print(i)

# 求 1 + 2 + 3 +...+ 100
# theSum = 0
# for i in range(1,101,1):
#     theSum += i
# print(f'sum={theSum}')

# 打印 1-10 的整数
# num = 1
# while num <= 10:
#     print(num)
#     num = num + 1

# 计算 1-100 的和
# sum 变量用于表示计算的和
# sum = 0
# num = 1
# while num <= 100:
#     sum += num
#     num += 1
# print(sum)

# 计算 5 的阶乘
# result = 1
# num = 1
# while num <= 5:
#     result *= num
#     num += 1
# print(f'result={result}')

# # 求 1！ + 2！ + 3！ + 4！ + 5!
# num = 1
# sum = 0
# while num <= 5:
#     factorResult = 1
#     i = 1
#     while i <= num:
#         factorResult *= i
#         i += 1
#     sum += factorResult
#     num += 1
# print(f'sum = {sum}')

# # 假设我要吃 5 个包子
# for i in range(1,6):
#     if i == 3:
#    # 发现第三个包子, 有一只虫~
#         continue
    # print(f'吃第 {i}个包子')
#
# for i in range(1,6):
#     if i == 3:
#         #发现第三个包子了，有半只虫
#         break
#     print(f'吃第 {i}个包子')

# 给定若干个数字，求平均值(也不知道几个数字)
# theSum = 0
# count = 0
# while True:
#   num = input("请输入数字:")
#   if num == ';':
#      break
#   num = float(num)
#   theSum +=num
#   count +=1
#
# print(f"平均值为:{theSum / count}")

